package com.flying.encapsulation;


/**
 * @ClassName:
 * @author: flying
 * @date 2024 2024/12/12 08:44
 * @Description: 测试封装
 * TODO：
 *  封装的使用
 *  将成员变量私有化，然后通过get/set 方法对外提供访问的方法
 *  get没有参数，有返回值；set有参数，无返回值
 *  set方法里通常形参名会和成员变量同名，此时需要使用 this.成员变量名  来赋值
 *
 *
 */
public class User {
    private String userName;
    private String passWord;
    private int age;
    private String gender;

    public User() {
    }

    public User(String userName, String passWord, int age, String gender) {
        this.userName = userName;
        this.passWord = passWord;
        this.age = age;
        this.gender = gender;
    }


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "User{" +
               "userName='" + userName + '\'' +
               ", passWord='" + passWord + '\'' +
               ", age=" + age +
               ", gender='" + gender + '\'' +
               '}';
    }










}
